##########################################################
# PLOT HOLOCAUST VICTIMS WHO PERISHED ON THE FRENCH SOIL #
##########################################################
# Author: Kasia Nalewajko
# First created: 12 March 2022
# Replicated: 8 June 2024

rm(list = ls())

# LOAD PACKAGES -----------------------------------------------------------

if (!require("dplyr")) install.packages("dplyr")
if (!require("viridis")) install.packages("viridis")
if (!require("ggplot2")) install.packages("ggplot2")
if (!require("sf")) install.packages("sf")

# LOAD DATA ---------------------------------------------------------------

load("./00 SUBMITTED/00 APSR final/04 replication_files/01 data/main.Rda")
frcantons1940 <- sf::read_sf("./00 SUBMITTED/00 APSR final/04 replication_files/01 data/Gay_CANTONS_1940/CANTONS_1940.shp")

# CLEAN AND PLOT ----------------------------------------------------------

france1940_sf <- st_as_sf(frcantons1940)

ressum <- main %>% 
  dplyr::select(deppct, all_jewish_victims) %>% 
  rename(nvictims = all_jewish_victims) 

france1940_sf <- left_join(france1940_sf, ressum)

france1940_sf %>%
  ggplot() +
  geom_sf() +
  aes(fill = log(nvictims+1)) +
  scale_fill_viridis(
    option = "inferno",
    trans = "reverse",
    na.value="gray90"
  ) +
  theme_bw() +
  theme(axis.text.x=element_blank(),
        axis.text.y=element_blank(),
        legend.position="bottom") +
  labs(title = "",
       subtitle = "",
       fill = "Number victims (logged)",
       x = "",
       y = "")

# SAVE ----------------------------------------------------------

ggsave(
  "2_Klarsfeld_cantons_logged.png",
  plot = last_plot(),
  path = "./00 SUBMITTED/00 APSR final/01 main_text/maps",
  width = 15,
  height = 15,
  units = "cm",
  dpi = 300
)
